#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void PrintArray(int *iArray, int iArrayLength) {
	for (int i = 0; i < iArrayLength; i ++) {
		printf("%4d", iArray[i]);
	}
	printf("\n");
}

int main() {
	int a[10] = {1, 2, 31, 4, 15, 6, 27, 23, 12, 24};
	printf("排序前：\n");
	PrintArray(a, 10);
	for (int i = 0; i < 10; i++) {
		for (int j = i + 1; j < 10; j++) {
			if (a[i] > a[j]) {
				int temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	}
	printf("排序后：\n");
	PrintArray(a, 10);

	return 0;
}
